/*
 * PacketTransmitter.cpp
 *
 *  Created on: 25 sept. 2009
 *      Author: CHETIER
 */

#include <iostream>
#include "PacketTransmitter.h"
#include "Config.h"

void PacketTransmitter::SendToClient(sf::IPAddress clientAdress, std::list<ClientInfo> listClientInfo)
{
	_clientAdress = clientAdress;
	_listClientInfo = listClientInfo;
	Launch();
}

void PacketTransmitter::Run()
{
	PacketInfo packetToSend;
	packetToSend << _listClientInfo;
	sf::SocketUDP server;
	if (server.Send(packetToSend, _clientAdress, PORT_SERVER_TO_CLIENT) != sf::Socket::Done)
	{
		std::cout << "error while sending packet..." << std::endl;
		return ;//EXIT_FAILURE;
	}
}

PacketTransmitter::~PacketTransmitter()
{
	Wait();
}









